import { http } from '@/plugins'
import { SYSTEM_URL } from '@/apis'

const baseURL = `${SYSTEM_URL}/department`
// const baseURL = process.env.BASE_API + '/department'

export default {
  /**
   * 查询列表
   * @param data
   * @returns {AxiosPromise}
   */
  selectList (data) {
    return http({
      url: `${baseURL}/selectDepartmentList`,
      method: 'POST',
      data
    })
  },
  /**
   * 查询字典类型列表
   * @param params
   * @returns {AxiosPromise}
   */
  selectTypeList (params) {
    return http({
      url: `${baseURL}/selectTypeList`,
      method: 'GET',
      params
    })
  },

  /**
   * 查询列表
   * @param data
   * @returns {AxiosPromise}
   */
  selectById (value) {
    return http({
      url: `${baseURL}/selectDepartmentById/${value}`,
      method: 'GET'
    })
  },
  /**
   * 新建
   * @param data
   * @returns {AxiosPromise}
   */
  create (data) {
    return http({
      url: `${baseURL}/createDepartment`,
      method: 'POST',
      data
    })
  },

  /**
   * 更新
   * @param data
   * @returns {AxiosPromise}
   */
  update (data) {
    return http({
      url: `${baseURL}/updateDepartment`,
      method: 'POST',
      data
    })
  },
  /**
   * delete
   * @param id
   * @returns {*}
   */
  deleteById (id) {
    return http({
      url: `${baseURL}/deleteDepartmentById/${id}`,
      method: 'DELETE'
    })
  }
}
